<!DOCTYPE html>
<html lang="en">

<head>
    <title><%- title %></title>
    <%- include common %>
</head>

<body>
    <%- include("head",{'title':'list',username}) %>
    <div class="container container-fluid">
        <div class="row" style="margin-top:20px">
            <h2 class="text-success">电影列表</h2>
        </div>
        <div class="row" style="margin-top:20px">
            <div class="col-md-12 col-sm-12 col-log-12">
                <button class="btn btn-info" onclick="location.href='/list?year=1'">年份升序</button>
                <button class="btn btn-danger" onclick="location.href='/list?year=-1'">年份降序</button>
                <button class="btn btn-success" onclick="location.href='/list?rating.average=1'">评分升序</button>
                <button class="btn btn-warning" onclick="location.href='/list?rating.average=-1'">评分降序</button>
            </div>
        </div>
        <div class="row" style="margin-top:20px">
            <div class="col-md-4 col-sm-4 col-log-4" style="display:flex">
               <input type="text" id="keyword" class="form-control" name="" id="keyword" placeholder="请输入关键字"> 
               <button class="btn btn-info" onclick="todoSearch()">点击搜索</button>
            </div>
        </div>
        <div class="row" style="margin-top:20px">
            <% result.forEach((item,index)=>{ %>
            <div class="col-md-3 col-sm-3">
                <div class="thumbnail">
                    <img src="<%- item.images.large.replace(/img7/,'img3') %>" alt="" style="height:260px;width:100%">
                    <div>
                        <h4 class="pull-right"> <%- item.year %></h4>
                        <h4 class="text-danger"> <%- item.title %></h4>
                        <p class="text-success">评分 : <%- item.rating.average %></p>
                        <p class="text-primary">分类 : <%- item.genres %></p>
                        <p class="text-primary">导演 : <%- item.directors[0].name %></p>
                    </div>
                    <button onclick="location.href='/comment/index?mid=<%- item.id%>'" class="btn btn-primary" style="width:100%;">点击评论</button>
                </div>
            </div>
            <% }) %>
        </div>
    </div>
    <%- include foot %>

    <script>
        function todoSearch(){
            window.location.href = "/list?keyword="+$("#keyword").val()
        }
    </script>
</body>

</html>